#ifndef XCAMERA_WIDGET_H
#define XCAMERA_WIDGET_H

#include <QWidget>

class XDecodeTask;
class XDemuxTask;
class XVideoView;
class XCameraWidget : public QWidget {
  Q_OBJECT

public:
  explicit XCameraWidget(QWidget *parent = nullptr);
  ~XCameraWidget();
  // 渲染视频
  void Draw();

protected:
  void paintEvent(QPaintEvent *ev) override;
  // 拖拽进入
  void dragEnterEvent(QDragEnterEvent *e) override;
  // 拖曳松开
  void dropEvent(QDropEvent *e) override;
  // 打开rtsp
  bool Open(const char *url);

private:
  XDecodeTask *decode_ = nullptr;
  XDemuxTask *demux_ = nullptr;
  XVideoView *view_ = nullptr;
};

#endif // XCAMERA_WIDGET_H
